﻿using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;

namespace EasyXaf.Sample.Module.BusinessObjects;

[Persistent]
[DefaultClassOptions]
public class UserGroup : BaseObject
{
    private string _name;
    private Department _department;

    public string Name
    {
        get => _name;
        set => SetPropertyValue(nameof(Name), ref _name, value);
    }

    [Association]
    public Department Department
    {
        get => _department;
        set => SetPropertyValue(nameof(Department), ref _department, value);
    }

    [Association]
    public XPCollection<ApplicationUser> Users
    {
        get => GetCollection<ApplicationUser>(nameof(Users));
    }

    public UserGroup(Session session)
        : base(session)
    {
    }
}
